package com.medusa.aps.business.modules.modeling.mp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.medusa.aps.business.modules.modeling.mp.entity.BomItem;
import com.medusa.aps.business.modules.modeling.mp.mapper.BomItemMapper;
import com.medusa.aps.business.modules.modeling.mp.service.BomItemService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * BOM 子项项服务实现类
 *
 * @author yuxh
 * @since 2023-08-14 17:37:43
 */
@Service("bomItemService")
public class BomItemServiceImpl extends ServiceImpl<BomItemMapper, BomItem> implements BomItemService {

    @Override
    public List<BomItem> selectBomItemByBomId(Integer bomId) {
        return lambdaQuery()
                .select(BomItem::getId, BomItem::getLevel, BomItem::getMaterialCode, BomItem::getMaterialId,
                        BomItem::getMaterialName, BomItem::getMaterialSpecification, BomItem::getProductionType,
                        BomItem::getParentId, BomItem::getUnit, BomItem::getUnitUsage, BomItem::getRemarks)
                .eq(BomItem::getBomId, bomId)
                .list();
    }

    @Override
    public void deletedBomItemByBomId(List<Integer> bomIdList) {
        lambdaUpdate().in(BomItem::getBomId, bomIdList).remove();
    }
}

